<?php
function callModule($data, $parent=0, $text="**", $select=0) {
        foreach($data as $k=>$v) {
            if($v["module_parent"] == $parent) {
                $id=$v["module_id"];
                if($select != 0 && $id == $select)
                    echo "<option value='".$id."' selected='selected'>$text $v[module_name]</option>";
                else
                    echo "<option value='".$id."'>$text $v[module_name]</option>";
                unset($data[$k]);
                callModule($data, $id, $text."**", $select);
            }
        }
    }
?>